package com.utils{
	public class Collide{
		///不变
		//质量
		public var quality:Number;
		public var attack:Number;
		private var _velocity:Number = 0;
		///变化
		//速度
		private var _speed:Number = 0;
		public var speedx:Number = 0;
		public var speedy:Number = 0;
		private var _angle:Number = 0;
		///特殊效果	如：医疗、毒、火等持续伤害
		public function Collide(quality:Number, attack:Number = 1){
			this.quality = quality;
			this.attack = attack;
		}
		
		public function get velocity():Number{
			return _velocity;
		}
		public function set velocity(value:Number):void{
			_velocity = value;
		}//close get set
		
		
		public function get speed():Number{
			return _speed;
		}
		public function set speed(value:Number):void{
			_speed = value;
			speedx = speed * Math.cos(_angle);
			speedy = speed * Math.sin(_angle);
		}//close get set
		
		public function get angle():Number{
			return _angle;
		}
		public function set angle(value:Number):void{
			//周期换算
			while(value < 0){
				value += Math.PI*2;
			}
			while(value > 2*Math.PI){
				value -= 2*Math.PI;
			}
			_angle = value;
			if (_angle == 0){
				trace("角度", _angle); 
			}
			
			speedx = speed * Math.cos(_angle);
			speedy = speed * Math.sin(_angle);
		}//close get set
	}
}